package brain;

import java.util.Calendar;
import java.text.SimpleDateFormat;

/**
 * 
 * @author JRVamplew
 *
 */
public class DateTime {
	  public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
	  private static String currentDate;
	  private static String currentTime;

	  private static String now() {
	    Calendar cal = Calendar.getInstance();
	    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
	    return sdf.format(cal.getTime());
	  }
	  
	  private static void seperateDateTime() {  
		  String currentDateTime = now();
		  String[] tempArray = currentDateTime.split("\\s");
		  currentDate = tempArray[0];
		  currentTime = tempArray[1];
	  }
	  
	  public static String time() {
		  seperateDateTime();
		  return currentTime;
	  }
	  
	  public static String date() {
		  seperateDateTime();
		  return currentDate;
	  }
	  
}
